home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / dpt106.zip / CLIENT.QC < prev    next >
Text File  |  1996-11-09  |  41KB  |  1,494 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11.  
  12. void() MOTD =
  13. {
  14.         if (self.motd_count < 10)
  15.         {
  16.                 self.motd_time = time + 1;
  17.                 self.motd_count = self.motd_count + 1;
  18.                 centerprint(self,"This server is running\n\n ─σß⌠Φφß⌠πΦ ╨∩≈σ≥ ╘∩∙≤ \n\nby ╨Θ╥ß═Θ─ß\n\n\nfreeware version 1.06 (final)\n");
  19.                 return;
  20.         }
  21.         else    sprint(self, "┼φßΘ∞ sman@niif.spb.su\n");
  22.         self.motd_time = 0;
  23. };
  24.  
  25. /*
  26. =============================================================================
  27.  
  28.                 LEVEL CHANGING / INTERMISSION
  29.  
  30. =============================================================================
  31. */
  32.  
  33. float    intermission_running;
  34. float    intermission_exittime;
  35.  
  36. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  37. This is the camera point for the intermission.
  38. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  39. */
  40. void() info_intermission =
  41. {
  42. };
  43.  
  44.  
  45.  
  46. void() SetChangeParms =
  47. {
  48. // remove items
  49.     self.items = self.items - (self.items &
  50.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  51.  
  52. // don't cap super health
  53. //        if (self.health > 100)
  54. //                self.health = 100;
  55.     if (self.health < 50)
  56.         self.health = 50;
  57.     parm1 = self.items;
  58.     parm2 = self.health;
  59.     parm3 = self.armorvalue;
  60.     if (self.ammo_shells < 25)
  61.         parm4 = 25;
  62.     else
  63.         parm4 = self.ammo_shells;
  64.     parm5 = self.ammo_nails;
  65.     parm6 = self.ammo_rockets;
  66.     parm7 = self.ammo_cells;
  67.     parm8 = self.weapon;
  68.     parm9 = self.armortype * 100;
  69. };
  70.  
  71. void() SetNewParms =
  72. {
  73.     parm1 = IT_SHOTGUN | IT_AXE;
  74.     parm2 = 100;
  75.     parm3 = 0;
  76.     parm4 = 25;
  77.     parm5 = 0;
  78.     parm6 = 0;
  79.     parm6 = 0;
  80.     parm8 = 1;
  81.     parm9 = 0;
  82. };
  83.  
  84. void() DecodeLevelParms =
  85. {
  86.     if (serverflags)
  87.     {
  88.         if (world.model == "maps/start.bsp")
  89.             SetNewParms ();        // take away all stuff on starting new episode
  90.     }
  91.  
  92.     self.items = parm1;
  93.     self.health = parm2;
  94.     self.armorvalue = parm3;
  95.     self.ammo_shells = parm4;
  96.     self.ammo_nails = parm5;
  97.     self.ammo_rockets = parm6;
  98.     self.ammo_cells = parm7;
  99.     self.weapon = parm8;
  100.     self.armortype = parm9 * 0.01;
  101. };
  102.  
  103. /*
  104. ============
  105. FindIntermission
  106.  
  107. Returns the entity to view from
  108. ============
  109. */
  110. entity() FindIntermission =
  111. {
  112.     local    entity spot;
  113.     local    float cyc;
  114.  
  115. // look for info_intermission first
  116.     spot = find (world, classname, "info_intermission");
  117.     if (spot)
  118.     {    // pick a random one
  119.         cyc = random() * 4;
  120.         while (cyc > 1)
  121.         {
  122.             spot = find (spot, classname, "info_intermission");
  123.             if (!spot)
  124.                 spot = find (spot, classname, "info_intermission");
  125.             cyc = cyc - 1;
  126.         }
  127.         return spot;
  128.     }
  129.  
  130. // then look for the start position
  131.     spot = find (world, classname, "info_player_start");
  132.     if (spot)
  133.         return spot;
  134.  
  135. // testinfo_player_start is only found in regioned levels
  136.     spot = find (world, classname, "testplayerstart");
  137.     if (spot)
  138.         return spot;
  139.  
  140.     objerror ("FindIntermission: no spot");
  141. };
  142.  
  143.  
  144. string nextmap;
  145. void() GotoNextMap =
  146. {
  147.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  148.         changelevel (mapname);
  149.     else
  150.         changelevel (nextmap);
  151. };
  152.  
  153.  
  154. void() ExitIntermission =
  155. {
  156. // skip any text in deathmatch
  157.     if (deathmatch)
  158.     {
  159.         GotoNextMap ();
  160.         return;
  161.     }
  162.  
  163.     intermission_exittime = time + 1;
  164.     intermission_running = intermission_running + 1;
  165.  
  166. //
  167. // run some text if at the end of an episode
  168. //
  169.     if (intermission_running == 2)
  170.     {
  171.         if (world.model == "maps/e1m7.bsp")
  172.         {
  173.             WriteByte (MSG_ALL, SVC_CDTRACK);
  174.             WriteByte (MSG_ALL, 2);
  175.             WriteByte (MSG_ALL, 3);
  176.             if (!cvar("registered"))
  177.             {
  178.                 WriteByte (MSG_ALL, SVC_FINALE);
  179.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  180.             }
  181.             else
  182.             {
  183.                 WriteByte (MSG_ALL, SVC_FINALE);
  184.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  185.             }
  186.             return;
  187.         }
  188.         else if (world.model == "maps/e2m6.bsp")
  189.         {
  190.             WriteByte (MSG_ALL, SVC_CDTRACK);
  191.             WriteByte (MSG_ALL, 2);
  192.             WriteByte (MSG_ALL, 3);
  193.  
  194.             WriteByte (MSG_ALL, SVC_FINALE);
  195.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  196.             return;
  197.         }
  198.         else if (world.model == "maps/e3m6.bsp")
  199.         {
  200.             WriteByte (MSG_ALL, SVC_CDTRACK);
  201.             WriteByte (MSG_ALL, 2);
  202.             WriteByte (MSG_ALL, 3);
  203.  
  204.             WriteByte (MSG_ALL, SVC_FINALE);
  205.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  206.             return;
  207.         }
  208.         else if (world.model == "maps/e4m7.bsp")
  209.         {
  210.             WriteByte (MSG_ALL, SVC_CDTRACK);
  211.             WriteByte (MSG_ALL, 2);
  212.             WriteByte (MSG_ALL, 3);
  213.  
  214.             WriteByte (MSG_ALL, SVC_FINALE);
  215.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  216.             return;
  217.         }
  218.  
  219.         GotoNextMap();
  220.     }
  221.  
  222.     if (intermission_running == 3)
  223.     {
  224.         if (!cvar("registered"))
  225.         {    // shareware episode has been completed, go to sell screen
  226.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  227.             return;
  228.         }
  229.  
  230.         if ( (serverflags&15) == 15)
  231.         {
  232.             WriteByte (MSG_ALL, SVC_FINALE);
  233.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  234.             return;
  235.         }
  236.  
  237.     }
  238.  
  239.     GotoNextMap();
  240. };
  241.  
  242. /*
  243. ============
  244. IntermissionThink
  245.  
  246. When the player presses attack or jump, change to the next level
  247. ============
  248. */
  249. void() IntermissionThink =
  250. {
  251.     if (time < intermission_exittime)
  252.         return;
  253.  
  254.     if (!self.button0 && !self.button1 && !self.button2)
  255.         return;
  256.  
  257.     ExitIntermission ();
  258. };
  259.  
  260. void() execute_changelevel =
  261. {
  262.     local entity    pos;
  263.  
  264.     intermission_running = 1;
  265.  
  266. // enforce a wait time before allowing changelevel
  267.     if (deathmatch)
  268.         intermission_exittime = time + 5;
  269.     else
  270.         intermission_exittime = time + 2;
  271.  
  272.     WriteByte (MSG_ALL, SVC_CDTRACK);
  273.     WriteByte (MSG_ALL, 3);
  274.     WriteByte (MSG_ALL, 3);
  275.  
  276.     pos = FindIntermission ();
  277.  
  278.     other = find (world, classname, "player");
  279.     while (other != world)
  280.     {
  281.         other.view_ofs = '0 0 0';
  282.         other.angles = other.v_angle = pos.mangle;
  283.         other.fixangle = TRUE;        // turn this way immediately
  284.         other.nextthink = time + 0.5;
  285.         other.takedamage = DAMAGE_NO;
  286.         other.solid = SOLID_NOT;
  287.         other.movetype = MOVETYPE_NONE;
  288.         other.modelindex = 0;
  289.         setorigin (other, pos.origin);
  290.         other = find (other, classname, "player");
  291.     }
  292.  
  293.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  294. };
  295.  
  296.  
  297. void() changelevel_touch =
  298. {
  299.     local entity    pos;
  300.  
  301.     if (other.classname != "player")
  302.         return;
  303.  
  304.     if (cvar("noexit"))
  305.     {
  306.         T_Damage (other, self, self, 50000);
  307.         return;
  308.     }
  309.     bprint (other.netname);
  310.     bprint (" exited the level\n");
  311.  
  312.     nextmap = self.map;
  313.  
  314.     SUB_UseTargets ();
  315.  
  316.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  317.     {    // NO_INTERMISSION
  318.         GotoNextMap();
  319.         return;
  320.     }
  321.  
  322.     self.touch = SUB_Null;
  323.  
  324. // we can't move people right now, because touch functions are called
  325. // in the middle of C movement code, so set a think time to do it
  326.     self.think = execute_changelevel;
  327.     self.nextthink = time + 0.1;
  328. };
  329.  
  330. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  331. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  332. */
  333. void() trigger_changelevel =
  334. {
  335.     if (!self.map)
  336.         objerror ("chagnelevel trigger doesn't have map");
  337.  
  338.     InitTrigger ();
  339.     self.touch = changelevel_touch;
  340. };
  341.  
  342.  
  343. /*
  344. =============================================================================
  345.  
  346.                 PLAYER GAME EDGE FUNCTIONS
  347.  
  348. =============================================================================
  349. */
  350.  
  351. void() set_suicide_frame;
  352.  
  353. // called by ClientKill and DeadThink
  354. void() respawn =
  355. {
  356.     if (coop)
  357.     {
  358.         // make a copy of the dead body for appearances sake
  359.         CopyToBodyQue (self);
  360.         // get the spawn parms as they were at level start
  361.         setspawnparms (self);
  362.         // respawn
  363.         PutClientInServer ();
  364.     }
  365.     else if (deathmatch)
  366.     {
  367.         // make a copy of the dead body for appearances sake
  368.         CopyToBodyQue (self);
  369.         // set default spawn parms
  370.         SetNewParms ();
  371.         // respawn
  372.         PutClientInServer ();
  373.     }
  374.     else
  375.     {    // restart the entire server
  376.         localcmd ("restart\n");
  377.     }
  378. };
  379.  
  380.  
  381. /*
  382. ============
  383. ClientKill
  384.  
  385. Player entered the suicide command
  386. ============
  387. */
  388. void() ClientKill =
  389. {
  390.     bprint (self.netname);
  391.     bprint (" suicides\n");
  392.     set_suicide_frame ();
  393.     self.modelindex = modelindex_player;
  394.     self.frags = self.frags - 2;    // extra penalty
  395.     respawn ();
  396. };
  397.  
  398. float(vector v) CheckSpawnPoint =
  399. {
  400.     return FALSE;
  401. };
  402.  
  403. /*
  404. ============
  405. SelectSpawnPoint
  406.  
  407. Returns the entity to spawn at
  408. ============
  409. */
  410. entity() SelectSpawnPoint =
  411. {
  412.     local    entity spot;
  413.  
  414. // testinfo_player_start is only found in regioned levels
  415.     spot = find (world, classname, "testplayerstart");
  416.     if (spot)
  417.         return spot;
  418.  
  419. // choose a info_player_deathmatch point
  420.     if (coop)
  421.     {
  422.         lastspawn = find(lastspawn, classname, "info_player_coop");
  423.         if (lastspawn == world)
  424.             lastspawn = find (lastspawn, classname, "info_player_start");
  425.         if (lastspawn != world)
  426.             return lastspawn;
  427.     }
  428.     else if (deathmatch)
  429.     {
  430.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  431.         if (lastspawn == world)
  432.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  433.         if (lastspawn != world)
  434.             return lastspawn;
  435.     }
  436.  
  437.     if (serverflags)
  438.     {    // return with a rune to start
  439.         spot = find (world, classname, "info_player_start2");
  440.         if (spot)
  441.             return spot;
  442.     }
  443.  
  444.     spot = find (world, classname, "info_player_start");
  445.     if (!spot)
  446.         error ("PutClientInServer: no info_player_start on level");
  447.  
  448.     return spot;
  449. };
  450.  
  451. /*
  452. ===========
  453. PutClientInServer
  454.  
  455. called each time a player is spawned
  456. ============
  457. */
  458. void() DecodeLevelParms;
  459. void() PlayerDie;
  460.  
  461.  
  462. void() PutClientInServer =
  463. {
  464.     local    entity spot;
  465.  
  466.     self.classname = "player";
  467.     self.health = 100;
  468.     self.takedamage = DAMAGE_AIM;
  469.     self.solid = SOLID_SLIDEBOX;
  470.     self.movetype = MOVETYPE_WALK;
  471.     self.show_hostile = 0;
  472.     self.max_health = 100;
  473.     self.flags = FL_CLIENT;
  474.     self.air_finished = time + 12;
  475.     self.dmg = 2;           // initial water damage
  476.     self.super_damage_finished = 0;
  477.     self.radsuit_finished = 0;
  478.     self.invisible_finished = 0;
  479.     self.invincible_finished = 0;
  480.     self.effects = 0;
  481.     self.invincible_time = 0;
  482.         self.spikes = 0;
  483.         self.isprotected = 0;
  484.         self.num = 0;
  485.  
  486.     DecodeLevelParms ();
  487.  
  488.     W_SetCurrentAmmo ();
  489.  
  490.     self.attack_finished = time;
  491.     self.th_pain = player_pain;
  492.     self.th_die = PlayerDie;
  493.  
  494.     self.deadflag = DEAD_NO;
  495. // paustime is set by teleporters to keep the player from moving a while
  496.     self.pausetime = 0;
  497.  
  498.     spot = SelectSpawnPoint ();
  499.  
  500.     self.origin = spot.origin + '0 0 1';
  501.     self.angles = spot.angles;
  502.     self.fixangle = TRUE;        // turn this way immediately
  503.  
  504. // oh, this is a hack!
  505.     setmodel (self, "progs/eyes.mdl");
  506.     modelindex_eyes = self.modelindex;
  507.  
  508.     setmodel (self, "progs/player.mdl");
  509.     modelindex_player = self.modelindex;
  510.  
  511.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  512.  
  513.     self.view_ofs = '0 0 22';
  514.  
  515.     player_stand1 ();
  516.  
  517.     if (deathmatch || coop)
  518.     {
  519.         makevectors(self.angles);
  520.         spawn_tfog (self.origin + v_forward*20);
  521.     }
  522.  
  523.     spawn_tdeath (self.origin, self);
  524. };
  525.  
  526.  
  527. /*
  528. =============================================================================
  529.  
  530.                 QUAKED FUNCTIONS
  531.  
  532. =============================================================================
  533. */
  534.  
  535.  
  536. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  537. The normal starting point for a level.
  538. */
  539. void() info_player_start =
  540. {
  541. };
  542.  
  543.  
  544. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  545. Only used on start map for the return point from an episode.
  546. */
  547. void() info_player_start2 =
  548. {
  549. };
  550.  
  551.  
  552. /*
  553. saved out by quaked in region mode
  554. */
  555. void() testplayerstart =
  556. {
  557. };
  558.  
  559. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  560. potential spawning position for deathmatch games
  561. */
  562. void() info_player_deathmatch =
  563. {
  564. };
  565.  
  566. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  567. potential spawning position for coop games
  568. */
  569. void() info_player_coop =
  570. {
  571. };
  572.  
  573. /*
  574. ===============================================================================
  575.  
  576. RULES
  577.  
  578. ===============================================================================
  579. */
  580.  
  581. void(entity c) PrintClientScore =
  582. {
  583.     if (c.frags > -10 && c.frags < 0)
  584.         bprint (" ");
  585.     else if (c.frags >= 0)
  586.     {
  587.         if (c.frags < 100)
  588.             bprint (" ");
  589.         if (c.frags < 10)
  590.             bprint (" ");
  591.     }
  592.     bprint (ftos(c.frags));
  593.     bprint (" ");
  594.     bprint (c.netname);
  595.     bprint ("\n");
  596. };
  597.  
  598. void() DumpScore =
  599. {
  600.     local entity    e, sort, walk;
  601.  
  602.     if (world.chain)
  603.         error ("DumpScore: world.chain is set");
  604.  
  605. // build a sorted list
  606.     e = find(world, classname, "player");
  607.     sort = world;
  608.     while (e)
  609.     {
  610.         if (!sort)
  611.         {
  612.             sort = e;
  613.             e.chain = world;
  614.         }
  615.         else
  616.         {
  617.             if (e.frags > sort.frags)
  618.             {
  619.                 e.chain = sort;
  620.                 sort = e;
  621.             }
  622.             else
  623.             {
  624.                 walk = sort;
  625.                 do
  626.                 {
  627.                     if (!walk.chain)
  628.                     {
  629.                         e.chain = world;
  630.                         walk.chain = e;
  631.                     }
  632.                     else if (walk.chain.frags < e.frags)
  633.                     {
  634.                         e.chain = walk.chain;
  635.                         walk.chain = e;
  636.                     }
  637.                     else
  638.                         walk = walk.chain;
  639.                 } while (walk.chain != e);
  640.             }
  641.         }
  642.  
  643.         e = find(e, classname, "player");
  644.     }
  645.  
  646. // print the list
  647.  
  648.     bprint ("\n");
  649.     while (sort)
  650.     {
  651.         PrintClientScore (sort);
  652.         sort = sort.chain;
  653.     }
  654.     bprint ("\n");
  655. };
  656.  
  657. /*
  658. go to the next level for deathmatch
  659. */
  660. void() NextLevel =
  661. {
  662.     local entity o;
  663.  
  664. // find a trigger changelevel
  665.     o = find(world, classname, "trigger_changelevel");
  666.     if (!o || mapname == "start")
  667.     {    // go back to same map if no trigger_changelevel
  668.         o = spawn();
  669.         o.map = mapname;
  670.     }
  671.  
  672.     nextmap = o.map;
  673.  
  674.     if (o.nextthink < time)
  675.     {
  676.         o.think = execute_changelevel;
  677.         o.nextthink = time + 0.1;
  678.     }
  679. };
  680.  
  681. /*
  682. ============
  683. CheckRules
  684.  
  685. Exit deathmatch games upon conditions
  686. ============
  687. */
  688. void() CheckRules =
  689. {
  690.     local    float        timelimit;
  691.     local    float        fraglimit;
  692.  
  693.     if (gameover)    // someone else quit the game already
  694.         return;
  695.  
  696.     timelimit = cvar("timelimit") * 60;
  697.     fraglimit = cvar("fraglimit");
  698.  
  699.     if (timelimit && time >= timelimit)
  700.     {
  701. NextLevel ();
  702. /*
  703.         gameover = TRUE;
  704.         bprint ("\n\n\n==============================\n");
  705.         bprint ("game exited after ");
  706.         bprint (ftos(timelimit/60));
  707.         bprint (" minutes\n");
  708.         DumpScore ();
  709.         localcmd ("killserver\n");
  710. */
  711.         return;
  712.     }
  713.  
  714.     if (fraglimit && self.frags >= fraglimit)
  715.     {
  716. NextLevel ();
  717. /*
  718.         gameover = TRUE;
  719.         bprint ("\n\n\n==============================\n");
  720.         bprint ("game exited after ");
  721.         bprint (ftos(self.frags));
  722.         bprint (" frags\n");
  723.         DumpScore ();
  724.         localcmd ("killserver\n");
  725. */
  726.         return;
  727.     }
  728. };
  729.  
  730. //============================================================================
  731.  
  732. void() PlayerDeathThink =
  733. {
  734.     local entity    old_self;
  735.     local float        forward;
  736.  
  737.     if ((self.flags & FL_ONGROUND))
  738.     {
  739.         forward = vlen (self.velocity);
  740.         forward = forward - 20;
  741.         if (forward <= 0)
  742.             self.velocity = '0 0 0';
  743.         else
  744.             self.velocity = forward * normalize(self.velocity);
  745.     }
  746.  
  747. // wait for all buttons released
  748.     if (self.deadflag == DEAD_DEAD)
  749.     {
  750.         if (self.button2 || self.button1 || self.button0)
  751.             return;
  752.         self.deadflag = DEAD_RESPAWNABLE;
  753.         return;
  754.     }
  755.  
  756. // wait for any button down
  757.     if (!self.button2 && !self.button1 && !self.button0)
  758.         return;
  759.  
  760.     self.button0 = 0;
  761.     self.button1 = 0;
  762.     self.button2 = 0;
  763.     respawn();
  764. };
  765.  
  766.  
  767. void() PlayerJump =
  768. {
  769.     local vector start, end;
  770.  
  771.     if (self.flags & FL_WATERJUMP)
  772.         return;
  773.  
  774.     if (self.waterlevel >= 2)
  775.     {
  776.         if (self.watertype == CONTENT_WATER)
  777.             self.velocity_z = 100;
  778.         else if (self.watertype == CONTENT_SLIME)
  779.             self.velocity_z = 80;
  780.         else
  781.             self.velocity_z = 50;
  782.  
  783. // play swiming sound
  784.         if (self.swim_flag < time)
  785.         {
  786.             self.swim_flag = time + 1;
  787.             if (random() < 0.5)
  788.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  789.             else
  790.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  791.         }
  792.  
  793.         return;
  794.     }
  795.  
  796.     if (!(self.flags & FL_ONGROUND))
  797.         return;
  798.  
  799.     if ( !(self.flags & FL_JUMPRELEASED) )
  800.         return;        // don't pogo stick
  801.  
  802.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  803.  
  804.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  805.  
  806.     self.button2 = 0;
  807. // player jumping sound
  808.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  809.     self.velocity_z = self.velocity_z + 270;
  810. };
  811.  
  812.  
  813. /*
  814. ===========
  815. WaterMove
  816.  
  817. ============
  818. */
  819. .float    dmgtime;
  820.  
  821. void() WaterMove =
  822. {
  823. //dprint (ftos(self.waterlevel));
  824.     if (self.movetype == MOVETYPE_NOCLIP)
  825.         return;
  826.     if (self.health < 0)
  827.         return;
  828.  
  829.     if (self.waterlevel != 3)
  830.     {
  831.         if (self.air_finished < time)
  832.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  833.         else if (self.air_finished < time + 9)
  834.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  835.         self.air_finished = time + 12;
  836.         self.dmg = 2;
  837.     }
  838.     else if (self.air_finished < time)
  839.     {    // drown!
  840.         if (self.pain_finished < time)
  841.         {
  842.             self.dmg = self.dmg + 2;
  843.             if (self.dmg > 15)
  844.                 self.dmg = 10;
  845.             T_Damage (self, world, world, self.dmg);
  846.             self.pain_finished = time + 1;
  847.         }
  848.     }
  849.  
  850.     if (!self.waterlevel)
  851.     {
  852.         if (self.flags & FL_INWATER)
  853.         {
  854.             // play leave water sound
  855.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  856.             self.flags = self.flags - FL_INWATER;
  857.         }
  858.         return;
  859.     }
  860.  
  861.     if (self.watertype == CONTENT_LAVA)
  862.     {    // do damage
  863.         if (self.dmgtime < time)
  864.         {
  865.             if (self.radsuit_finished > time)
  866.                 self.dmgtime = time + 1;
  867.             else
  868.                 self.dmgtime = time + 0.2;
  869.  
  870.             T_Damage (self, world, world, 10*self.waterlevel);
  871.         }
  872.     }
  873.     else if (self.watertype == CONTENT_SLIME)
  874.     {    // do damage
  875.         if (self.dmgtime < time && self.radsuit_finished < time)
  876.         {
  877.             self.dmgtime = time + 1;
  878.             T_Damage (self, world, world, 4*self.waterlevel);
  879.         }
  880.     }
  881.  
  882.     if ( !(self.flags & FL_INWATER) )
  883.     {
  884.  
  885. // player enter water sound
  886.  
  887.         if (self.watertype == CONTENT_LAVA)
  888.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  889.         if (self.watertype == CONTENT_WATER)
  890.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  891.         if (self.watertype == CONTENT_SLIME)
  892.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  893.  
  894.         self.flags = self.flags + FL_INWATER;
  895.         self.dmgtime = 0;
  896.     }
  897.  
  898.     if (! (self.flags & FL_WATERJUMP) )
  899.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  900. };
  901.  
  902. void() CheckWaterJump =
  903. {
  904.     local vector start, end;
  905.  
  906. // check for a jump-out-of-water
  907.     makevectors (self.angles);
  908.     start = self.origin;
  909.     start_z = start_z + 8;
  910.     v_forward_z = 0;
  911.     normalize(v_forward);
  912.     end = start + v_forward*24;
  913.     traceline (start, end, TRUE, self);
  914.     if (trace_fraction < 1)
  915.     {    // solid at waist
  916.         start_z = start_z + self.maxs_z - 8;
  917.         end = start + v_forward*24;
  918.         self.movedir = trace_plane_normal * -50;
  919.         traceline (start, end, TRUE, self);
  920.         if (trace_fraction == 1)
  921.         {    // open at eye level
  922.             self.flags = self.flags | FL_WATERJUMP;
  923.             self.velocity_z = 225;
  924.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  925.             self.teleport_time = time + 2;    // safety net
  926.             return;
  927.         }
  928.     }
  929. };
  930.  
  931.  
  932. /*
  933. ================
  934. PlayerPreThink
  935.  
  936. Called every frame before physics are run
  937. ================
  938. */
  939. void() PlayerPreThink =
  940. {
  941.     local    float    mspeed, aspeed;
  942.     local    float    r;
  943.  
  944.     if (intermission_running)
  945.     {
  946.         IntermissionThink ();    // otherwise a button could be missed between
  947.         return;                    // the think tics
  948.     }
  949.  
  950.     if (self.view_ofs == '0 0 0')
  951.         return;        // intermission or finale
  952.  
  953.     makevectors (self.v_angle);        // is this still used
  954.  
  955.         if (self.motd_time && self.motd_time < time)
  956.                 MOTD();
  957.  
  958.         CheckRules ();
  959.     WaterMove ();
  960.  
  961.     if (self.waterlevel == 2)
  962.         CheckWaterJump ();
  963.  
  964.     if (self.deadflag >= DEAD_DEAD)
  965.     {
  966.         PlayerDeathThink ();
  967.         return;
  968.     }
  969.  
  970.     if (self.deadflag == DEAD_DYING)
  971.         return;    // dying, so do nothing
  972.  
  973.     if (self.button2)
  974.     {
  975.         PlayerJump ();
  976.     }
  977.     else
  978.         self.flags = self.flags | FL_JUMPRELEASED;
  979.  
  980. // teleporters can force a non-moving pause time
  981.     if (time < self.pausetime)
  982.         self.velocity = '0 0 0';
  983. };
  984.  
  985. /*
  986. ================
  987. CheckPowerups
  988.  
  989. Check for turning off powerups
  990. ================
  991. */
  992. void() CheckPowerups =
  993. {
  994.     if (self.health <= 0)
  995.         return;
  996.  
  997. // invisibility
  998.     if (self.invisible_finished)
  999.     {
  1000. // sound and screen flash when items starts to run out
  1001.         if (self.invisible_sound < time)
  1002.         {
  1003.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1004.             self.invisible_sound = time + ((random() * 3) + 1);
  1005.         }
  1006.  
  1007.  
  1008.         if (self.invisible_finished < time + 3)
  1009.         {
  1010.             if (self.invisible_time == 1)
  1011.             {
  1012.                 sprint (self, "Ring of Shadows magic is fading\n");
  1013.                 stuffcmd (self, "bf\n");
  1014.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1015.                 self.invisible_time = time + 1;
  1016.             }
  1017.  
  1018.             if (self.invisible_time < time)
  1019.             {
  1020.                 self.invisible_time = time + 1;
  1021.                 stuffcmd (self, "bf\n");
  1022.             }
  1023.         }
  1024.  
  1025.         if (self.invisible_finished < time)
  1026.         {    // just stopped
  1027.             self.items = self.items - IT_INVISIBILITY;
  1028.             self.invisible_finished = 0;
  1029.             self.invisible_time = 0;
  1030.         }
  1031.  
  1032.     // use the eyes
  1033.         self.frame = 0;
  1034.         self.modelindex = modelindex_eyes;
  1035.     }
  1036.     else
  1037.         self.modelindex = modelindex_player;    // don't use eyes
  1038.  
  1039. // invincibility
  1040.     if (self.invincible_finished)
  1041.     {
  1042. // sound and screen flash when items starts to run out
  1043.         if (self.invincible_finished < time + 3)
  1044.         {
  1045.             if (self.invincible_time == 1)
  1046.             {
  1047.                 sprint (self, "Protection is almost burned out\n");
  1048.                 stuffcmd (self, "bf\n");
  1049.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1050.                 self.invincible_time = time + 1;
  1051.             }
  1052.  
  1053.             if (self.invincible_time < time)
  1054.             {
  1055.                 self.invincible_time = time + 1;
  1056.                 stuffcmd (self, "bf\n");
  1057.             }
  1058.         }
  1059.  
  1060.         if (self.invincible_finished < time)
  1061.         {    // just stopped
  1062.             self.items = self.items - IT_INVULNERABILITY;
  1063.             self.invincible_time = 0;
  1064.             self.invincible_finished = 0;
  1065.         }
  1066.         if (self.invincible_finished > time)
  1067.             self.effects = self.effects | EF_DIMLIGHT;
  1068.         else
  1069.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1070.     }
  1071.  
  1072. // super damage
  1073.     if (self.super_damage_finished)
  1074.     {
  1075.  
  1076. // sound and screen flash when items starts to run out
  1077.  
  1078.         if (self.super_damage_finished < time + 3)
  1079.         {
  1080.             if (self.super_time == 1)
  1081.             {
  1082.                 sprint (self, "Quad Damage is wearing off\n");
  1083.                 stuffcmd (self, "bf\n");
  1084.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1085.                 self.super_time = time + 1;
  1086.             }
  1087.  
  1088.             if (self.super_time < time)
  1089.             {
  1090.                 self.super_time = time + 1;
  1091.                 stuffcmd (self, "bf\n");
  1092.             }
  1093.         }
  1094.  
  1095.         if (self.super_damage_finished < time)
  1096.         {    // just stopped
  1097.             self.items = self.items - IT_QUAD;
  1098.             self.super_damage_finished = 0;
  1099.             self.super_time = 0;
  1100.         }
  1101.         if (self.super_damage_finished > time)
  1102.             self.effects = self.effects | EF_DIMLIGHT;
  1103.         else
  1104.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1105.     }
  1106.  
  1107. // suit
  1108.     if (self.radsuit_finished)
  1109.     {
  1110.         self.air_finished = time + 12;        // don't drown
  1111.  
  1112. // sound and screen flash when items starts to run out
  1113.         if (self.radsuit_finished < time + 3)
  1114.         {
  1115.             if (self.rad_time == 1)
  1116.             {
  1117.                 sprint (self, "Air supply in Biosuit expiring\n");
  1118.                 stuffcmd (self, "bf\n");
  1119.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1120.                 self.rad_time = time + 1;
  1121.             }
  1122.  
  1123.             if (self.rad_time < time)
  1124.             {
  1125.                 self.rad_time = time + 1;
  1126.                 stuffcmd (self, "bf\n");
  1127.             }
  1128.         }
  1129.  
  1130.         if (self.radsuit_finished < time)
  1131.         {    // just stopped
  1132.             self.items = self.items - IT_SUIT;
  1133.             self.rad_time = 0;
  1134.             self.radsuit_finished = 0;
  1135.         }
  1136.     }
  1137.  
  1138. };
  1139.  
  1140.  
  1141. /*
  1142. ================
  1143. PlayerPostThink
  1144.  
  1145. Called every frame after physics are run
  1146. ================
  1147. */
  1148. void() PlayerPostThink =
  1149. {
  1150.     local    float    mspeed, aspeed;
  1151.     local    float    r;
  1152.  
  1153.     if (self.view_ofs == '0 0 0')
  1154.         return;        // intermission or finale
  1155.     if (self.deadflag)
  1156.         return;
  1157.  
  1158. // do weapon stuff
  1159.  
  1160.     W_WeaponFrame ();
  1161.  
  1162. // check to see if player landed and play landing sound
  1163.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1164.     {
  1165.         if (self.watertype == CONTENT_WATER)
  1166.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1167.         else if (self.jump_flag < -650)
  1168.         {
  1169.             T_Damage (self, world, world, 5);
  1170.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1171.             self.deathtype = "falling";
  1172.         }
  1173.         else
  1174.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1175.  
  1176.         self.jump_flag = 0;
  1177.     }
  1178.  
  1179.     if (!(self.flags & FL_ONGROUND))
  1180.         self.jump_flag = self.velocity_z;
  1181.  
  1182.     CheckPowerups ();
  1183. };
  1184.  
  1185.  
  1186. /*
  1187. ===========
  1188. ClientConnect
  1189.  
  1190. called when a player connects to a server
  1191. ============
  1192. */
  1193. void() ClientConnect =
  1194. {
  1195.     bprint (self.netname);
  1196.     bprint (" entered the game\n");
  1197.  
  1198.         self.motd_time = time + 3;
  1199.         self.motd_count = 0;
  1200.  
  1201.  
  1202. // a client connecting during an intermission can cause problems
  1203.     if (intermission_running)
  1204.         ExitIntermission ();
  1205. };
  1206.  
  1207.  
  1208. /*
  1209. ===========
  1210. ClientDisconnect
  1211.  
  1212. called when a player disconnects from a server
  1213. ============
  1214. */
  1215. void() ClientDisconnect =
  1216. {
  1217.         local string leave;
  1218.     if (gameover)
  1219.         return;
  1220.     // if the level end trigger has been activated, just return
  1221.     // since they aren't *really* leaving
  1222.  
  1223.     // let everyone else know
  1224.         if (self.frags > 100)
  1225.         {
  1226.         leave = " is off with honorable ";
  1227.         }
  1228.         else if (self.frags > 40)
  1229.         {
  1230.         leave = " says goodbye with ";
  1231.         }
  1232.         else if (self.frags > 10)
  1233.         {
  1234.         leave = " didn't do lots of fragging and left with ";
  1235.         }
  1236.         else
  1237.         {
  1238.         leave = " chickened out with ";
  1239.         }
  1240.     bprint (self.netname);
  1241.         bprint (leave);
  1242.     bprint (ftos(self.frags));
  1243.     bprint (" frags\n");
  1244.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1245.     set_suicide_frame ();
  1246. };
  1247.  
  1248. /*
  1249. ===========
  1250. ClientObituary
  1251.  
  1252. called when a player dies // MODIFIED by Piramida
  1253. ============
  1254. */
  1255. void(entity targ, entity attacker, entity inflictor) ClientObituary =
  1256. {
  1257.         local   float rnum;
  1258.         local   string deathstring, deathstring2;
  1259.         rnum = random();
  1260.  
  1261.         if (targ.classname == "player")
  1262.         {
  1263.                 if (attacker.classname == "teledeath")
  1264.                 {
  1265.                         bprint (targ.netname);
  1266.                         bprint (" was telefragged by ");
  1267.                         bprint (attacker.owner.netname);
  1268.                         bprint ("\n");
  1269.  
  1270.                         attacker.owner.frags = attacker.owner.frags + 1;
  1271.                         return;
  1272.                 }
  1273.  
  1274.                 if (attacker.classname == "teledeath2")
  1275.                 {
  1276.                         bprint ("Satan's power deflects ");
  1277.                         bprint (targ.netname);
  1278.                         bprint ("'s telefrag\n");
  1279.  
  1280.                         targ.frags = targ.frags - 1;
  1281.                         return;
  1282.                 }
  1283.  
  1284.                 if (attacker.classname == "player")
  1285.                 {
  1286.                         if (targ == attacker)
  1287.                         {
  1288.                                 // killed self
  1289.                                 attacker.frags = attacker.frags - 1;
  1290.                                 bprint (targ.netname);
  1291.                                 bprint (inflictor.classname);
  1292.                                 if (inflictor.classname == "grenade")
  1293.                                         bprint (" tries to put the pin back in\n");
  1294.                                 else if(inflictor.classname == "rocket")
  1295.                                         bprint (" shoots rockets too close to a wall\n");
  1296.                                 else if (rnum<0.9)
  1297.                                         bprint (" becomes bored with life\n");
  1298.                                 else
  1299.                                         bprint (" checks if his weapon is loaded\n");
  1300.                                 return;
  1301.                         }
  1302.                         else
  1303.                         {
  1304.                                 deathstring = "";
  1305.                                 attacker.frags = attacker.frags + 1;
  1306.  
  1307.                                 if (attacker.weapon == IT_AXE)
  1308.                                 {
  1309.                                         deathstring = " was ax-murdered by ";
  1310.                                         deathstring2 = "\n";
  1311.                                 }
  1312.                                 if (attacker.weapon == IT_SHOTGUN)
  1313.                                 {
  1314.                                         deathstring = " chewed on ";
  1315.                                         deathstring2 = "'s boomstick\n";
  1316.                                 }
  1317.                                 if (attacker.weapon == IT_LIGHTNING)
  1318.                                 {
  1319.                                         deathstring = " shares his health with ";
  1320.                                         deathstring2 = "\n";
  1321.                                 }
  1322.                                 if (inflictor.classname == "spike")
  1323.                                 {
  1324.                                 if(attacker.isprotected)    //Killed by Satellites
  1325.                                 {
  1326.                                         deathstring = " was killed by ";
  1327.                                         deathstring2 = "'s Protection\n";
  1328.                                         if (targ.health < -40)
  1329.                                         {
  1330.                                                 deathstring = " is torn by ";
  1331.                                                 deathstring2 = "'s Satellites\n" ;
  1332.                                         }
  1333.                                 }
  1334.                                 else
  1335.                                 {
  1336.                                         deathstring = " gets full stomach of ";
  1337.                                         deathstring2 = "'s nails\n";
  1338.                                         if(targ.health < -40)
  1339.                                         {
  1340.                                                 deathstring = " is dead meat, thanks to ";
  1341.                                                 deathstring2 = "\n";
  1342.                                         }
  1343.                                 }
  1344.                                 }
  1345.                                 if (inflictor.classname == "rocket")
  1346.                                 {       deathstring = " gets tired with ";
  1347.                                         deathstring2 = "'s rockets\n";
  1348.                                         if(targ.health < -40)
  1349.                                         {
  1350.                                         deathstring = " was destroyed by ";
  1351.                                         deathstring2 = "'s Destructor\n";
  1352.                                         }
  1353.                                 }
  1354.                                 if (inflictor.classname == "grenade")
  1355.                                 {
  1356.                                         deathstring = " gets close to ";
  1357.                                         deathstring2 = "'s Mine\n";
  1358.                                         if (targ.health < -40)
  1359.                                         {
  1360.                                                 deathstring = " was gibbed by ";
  1361.                                                 deathstring2 = "'s Mine\n";
  1362.                                         }
  1363.                                 }
  1364.                                 if (inflictor.classname == "Missile")
  1365.                                 {
  1366.                                         deathstring = " catches ";
  1367.                                         deathstring2 = "'s Missile\n";
  1368.                                         if (targ.health < -40)
  1369.                                         {
  1370.                                                 deathstring = " was gibbed by ";
  1371.                                                 deathstring2 = "'s Missile\n" ;
  1372.                                         }
  1373.                                 }
  1374.                                 if (deathstring == "")
  1375.                                 {
  1376.                                         deathstring = " is killed by ";
  1377.                                         deathstring2 = "\n";
  1378.                                 }
  1379.                                 bprint (targ.netname);
  1380.                                 bprint (deathstring);
  1381.                                 bprint (attacker.netname);
  1382.                                 bprint (deathstring2);
  1383.                         }
  1384.                         return;
  1385.                 }
  1386.                 else
  1387.                 {
  1388.                         targ.frags = targ.frags - 1;            // killed self
  1389.                         rnum = targ.watertype;
  1390.  
  1391.                         bprint (targ.netname);
  1392.                         if (rnum == -3)
  1393.                         {
  1394.                                 if (random() < 0.5)
  1395.                                         bprint (" sleeps with the fishes\n");
  1396.                                 else
  1397.                                         bprint (" sucks it down\n");
  1398.                                 return;
  1399.                         }
  1400.                         else if (rnum == -4)
  1401.                         {
  1402.                                 if (random() < 0.5)
  1403.                                         bprint (" gulped a load of slime\n");
  1404.                                 else
  1405.                                         bprint (" can't exist on slime alone\n");
  1406.                                 return;
  1407.                         }
  1408.                         else if (rnum == -5)
  1409.                         {
  1410.                                 if (targ.health < -15)
  1411.                                 {
  1412.                                         bprint (" burst into flames\n");
  1413.                                         return;
  1414.                                 }
  1415.                                 if (random() < 0.5)
  1416.                                         bprint (" turned into hot slag\n");
  1417.                                 else
  1418.                                         bprint (" visits the Volcano God\n");
  1419.                                 return;
  1420.                         }
  1421.  
  1422.                         if (attacker.flags & FL_MONSTER)
  1423.                         {
  1424.                                 if (attacker.classname == "monster_army")
  1425.                                         bprint (" was shot by a Grunt\n");
  1426.                                 if (attacker.classname == "monster_demon1")
  1427.                                         bprint (" was eviscerated by a Fiend\n");
  1428.                                 if (attacker.classname == "monster_dog")
  1429.                                         bprint (" was mauled by a Rottweiler\n");
  1430.                                 if (attacker.classname == "monster_dragon")
  1431.                                         bprint (" was fried by a Dragon\n");
  1432.                                 if (attacker.classname == "monster_enforcer")
  1433.                                         bprint (" was blasted by an Enforcer\n");
  1434.                                 if (attacker.classname == "monster_fish")
  1435.                                         bprint (" was fed to the Rotfish\n");
  1436.                                 if (attacker.classname == "monster_hell_knight")
  1437.                                         bprint (" was slain by a Death Knight\n");
  1438.                                 if (attacker.classname == "monster_knight")
  1439.                                         bprint (" was slashed by a Knight\n");
  1440.                                 if (attacker.classname == "monster_ogre")
  1441.                                         bprint (" was destroyed by an Ogre\n");
  1442.                                 if (attacker.classname == "monster_oldone")
  1443.                                         bprint (" became one with Shub-Niggurath\n");
  1444.                                 if (attacker.classname == "monster_shalrath")
  1445.                                         bprint (" was exploded by a Vore\n");
  1446.                                 if (attacker.classname == "monster_shambler")
  1447.                                         bprint (" was smashed by a Shambler\n");
  1448.                                 if (attacker.classname == "monster_tarbaby")
  1449.                                         bprint (" was slimed by a Spawn\n");
  1450.                                 if (attacker.classname == "monster_vomit")
  1451.                                         bprint (" was vomited on by a Vomitus\n");
  1452.                                 if (attacker.classname == "monster_wizard")
  1453.                                         bprint (" was scragged by a Scrag\n");
  1454.                                 if (attacker.classname == "monster_zombie")
  1455.                                         bprint (" joins the Zombies\n");
  1456.  
  1457.                                 return;
  1458.                         }
  1459.                         if (attacker.classname == "explo_box")
  1460.                         {
  1461.                                 bprint (" blew up\n");
  1462.                                 return;
  1463.                         }
  1464.                         if (attacker.solid == SOLID_BSP && attacker != world)
  1465.                         {
  1466.                                 bprint (" was squished\n");
  1467.                                 return;
  1468.                         }
  1469.                         if (targ.deathtype == "falling")
  1470.                         {
  1471.                                 targ.deathtype = "";
  1472.                                 bprint (" fell to his death\n");
  1473.                                 return;
  1474.                         }
  1475.                         if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1476.                         {
  1477.                                 bprint (" was spiked\n");
  1478.                                 return;
  1479.                         }
  1480.                         if (attacker.classname == "fireball")
  1481.                         {
  1482.                                 bprint (" ate a lavaball\n");
  1483.                                 return;
  1484.                         }
  1485.                         if (attacker.classname == "trigger_changelevel")
  1486.                         {
  1487.                                 bprint (" tried to leave\n");
  1488.                                 return;
  1489.                         }
  1490.  
  1491.                         bprint (" died\n");
  1492.                 }
  1493.         }
  1494. };